|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPER.rover.DetectMotionAction
This Action makes it easy to detect motion. The version of the Stargate/Stayton code on the robot you use must be at least 2.0.0.
While trying to detect motion, the rover is constantly taking pictures at 176x144. It adds up the brightness in 16x16 pixel blocks. The rover sends back the average difference between successive frames for all of the blocks. The DetectMotionAction waits until the average difference is above the defined threshold for at least a minimum number of blocks, or the specified timeout is exceeded. The Action is considered a success if motion is detected before the timeout is reached.
Constructor Summary | |
DetectMotionAction(int timeToWait)
Creates a new instance of DetectMotionAction. |
|
DetectMotionAction(int timeToWait,
int threshold,
int minimumBlocks)
Creates a new instance of DetectMotionAction Waits to detect motion in the specified time interval using user-defined parameters. |
Method Summary | |
boolean |
doAction(Rover r)
Tries to start the action. |
long |
getImageUpdateTime()
Lets you know when the last image was taken by this action. |
java.awt.image.BufferedImage |
getRecentImage()
Returns the most recent image taken by this Action. |
int |
getReturnValue()
The return value of the Action. |
java.lang.String |
getShortSummary()
Provides a shortened version of the summary returned by getSummary. |
java.lang.String |
getSummary()
Provides a textual explanation of the Action, such as "turn 90 degrees" |
int |
getTime()
Gets the maximum time that it will try to detect motion for in milliseconds. |
int |
getTimeRemaining()
How much time until the action finishes (in milliseconds), if it has already started. |
boolean |
isCompleted()
Whether the action has completed. |
boolean |
isSuccess()
For this action, success is considered detecting motion. |
void |
kill()
Emergency stop - end the action immediately, if it's running. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DetectMotionAction(int timeToWait)
timeToWait
- How many milliseconds to detect motion for.public DetectMotionAction(int timeToWait, int threshold, int minimumBlocks)
timeToWait
- How many milliseconds to detect motion for.threshold
- How much the brightness must change in a block for
it to be considered motion.minimumBlocks
- How many blocks must be above the threshold for
the Action to terminate.Method Detail |
public boolean doAction(Rover r)
Action
doAction
in interface Action
public int getTime()
getTime
in interface Action
public java.lang.String getSummary()
Action
getSummary
in interface Action
public java.lang.String getShortSummary()
Action
getShortSummary
in interface Action
public int getReturnValue()
Action
getReturnValue
in interface Action
RoverState
,
ActionConstants
public boolean isSuccess()
isSuccess
in interface Action
public boolean isCompleted()
Action
isCompleted
in interface Action
public void kill()
Action
kill
in interface Action
public int getTimeRemaining()
Action
getTimeRemaining
in interface Action
public long getImageUpdateTime()
Action
getImageUpdateTime
in interface Action
public java.awt.image.BufferedImage getRecentImage()
Action
getRecentImage
in interface Action
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |